enum MJValue {
    O1,
    O2,
    O3,
    O4,
    O5,
    O6,
    O7,
    O8,
    O9,
    I1,
    I2,
    I3,
    I4,
    I5,
    I6,
    I7,
    I8,
    I9,
    P1,
    P2,
    P3,
    P4,
    P5,
    P6,
    P7,
    P8,
    P9,
    DONG,
    NAN,
    XI,
    BEI,
    ZHONG,
    FA,
    BAI,
    COUNT
}

const BING = [MJValue.O1,
MJValue.O2,
MJValue.O3,
MJValue.O4,
MJValue.O5,
MJValue.O6,
MJValue.O7,
MJValue.O8,
MJValue.O9]

const TIAO = [MJValue.I1,
MJValue.I2,
MJValue.I3,
MJValue.I4,
MJValue.I5,
MJValue.I6,
MJValue.I7,
MJValue.I8,
MJValue.I9];

const WAN = [MJValue.P1,
MJValue.P2,
MJValue.P3,
MJValue.P4,
MJValue.P5,
MJValue.P6,
MJValue.P7,
MJValue.P8,
MJValue.P9];

const OTHER = [
    MJValue.DONG,
    MJValue.NAN,
    MJValue.XI,
    MJValue.BEI,
    MJValue.ZHONG,
    MJValue.FA,
    MJValue.BAI
];

const YAO = [
    MJValue.O1,
    MJValue.O9,
    MJValue.I1,
    MJValue.I9,
    MJValue.P1,
    MJValue.P9,
    MJValue.DONG,
    MJValue.NAN,
    MJValue.XI,
    MJValue.BEI,
    MJValue.ZHONG,
    MJValue.FA,
    MJValue.BAI
]

enum MJRemoveWay {
    CHI,
    PENG,
    GANG,
    HU,
}

enum MJType {
    BING,
    TIAO,
    WAN,
    OTHER
}

function getMJType(value) {
    if (BING.indexOf(value) != -1) {
        return MJType.BING;
    }
    if (TIAO.indexOf(value) != -1) {
        return MJType.TIAO;
    }
    if (WAN.indexOf(value) != -1) {
        return MJType.WAN
    }
    if (OTHER.indexOf(value) != -1) {
        return MJType.OTHER
    }
}

enum EventEnum {
    EVENT_SHUFFLE = "EVENT_SHUFFLE",
    EVENT_INHAND = "EVENT_INHAND",
    EVENT_DECKPOP = "EVENT_DECKPOP",
    EVENT_CHI = "EVENT_CHI",
    EVENT_PENG = "EVENT_PENG",
    EVENT_GANG = "EVENT_GANG",
    EVENT_SEVEN_PAIR = "EVENT_SEVEN_PAIR",
    EVENT_LONG = "EVENT_SEVEN_LONG",
    EVENT_ONE_COLOR = "",

    EVENT_PENG_FAIL = "EVENT_PENG_FAIL",

    SCORE_UPDATE = "SCORE_UPDATE"
}

interface MJTeam {
    mj: number[],
    way: MJRemoveWay
}

enum MJStyleEnum {
    STYLE_STAND = "zheng",
    STYLE_LIE = "ce"
}

export {
    MJValue,
    EventEnum,
    MJStyleEnum,
    BING, TIAO, WAN,
    MJType,
    getMJType,
    MJRemoveWay,
    MJTeam
}